/**
 * 
 */
package com.obradovicnjegovan.webprodavnica.pages.admin;

import java.util.Set;

import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Hibernate;

import com.obradovicnjegovan.webprodavnica.controller.ControllerAL;
import com.obradovicnjegovan.webprodavnica.entities.Korpa;
import com.obradovicnjegovan.webprodavnica.entities.Narudzbenica;
import com.obradovicnjegovan.webprodavnica.entities.OdabranProizvod;

/**
 * @author njegovan
 *
 */
public class ProizvodiNarudzbenice {
	@Persist
	private long id;

	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Property
	private OdabranProizvod odabranProizvod;
	@Inject
	private ControllerAL controllerAL;
	
	public Set<OdabranProizvod> getOdabraniProizvodi(){
		Korpa korpa = controllerAL.pronadjiKorpu(getId());
		Set<OdabranProizvod> set = korpa.getOdabraniProizvodi();
		Hibernate.initialize(set);
		return set;
	}
}